<!--
 * @Description: 退库
 * @Autor: 曹敬涛
 * @Date: 2021-09-28 17:24:36
 * @LastEditors: 商晓彬
 * @LastEditTime: 2022-02-23 09:32:12
-->
<div bsModal #createOrEditModal="bs-modal" (onShown)="onShown()" class="add modal fade" tabindex="-1" role="dialog"
  aria-labelledby="createOrEditModal" aria-hidden="true" [config]="{backdrop: 'static', keyboard: !saving}">

  <div style="width:1244px!important;margin: 1.75rem auto;">
    <div class="modal-content">
      <form *ngIf="active" #userForm="ngForm" novalidate autocomplete="off">
        <div class="modal-header">
          <h4 class="modal-title">
            <span>{{returnTitle}}</span>
          </h4>
          <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')" [disabled]="saving">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">
          <div>
            <div class="m-content">
              <div class="row">
                <div class="col-lg-12">
                  <div *ngIf="checktype ==3" class="ui-g">
                    <span class="ui-md-3 ui-lg-3 ui-sm-3">
                      <span class="input-lable">出库单号：</span>
                      <input disabled style=" width:150px;height: 35px;" name="deliveryNo" type="text"
                        [(ngModel)]="warehouseInfo.deliveryNo" />
                    </span>
                    <span class="ui-md-3 ui-lg-3 ui-sm-3">
                      <span class="input-lable">仓库名称：</span>
                      <input disabled style=" width:150px;height: 35px;" name="stroeName" type="text"
                        [(ngModel)]="warehouseInfo.stroeName" />
                    </span>
                    <span class="ui-md-3 ui-lg-3 ui-sm-3">
                      <span class="input-lable">装配任务号：</span>
                      <input disabled style=" width:150px;height: 35px;" name="sssemblyTaskNumber" type="text"
                        [(ngModel)]="warehouseInfo.sssemblyTaskNumber" />
                    </span>
                    <span class="ui-md-3 ui-lg-3 ui-sm-3">
                      <span class="input-lable">型号：</span>
                      <input disabled style=" width:150px;height: 35px;" name="productCode" type="text"
                        [(ngModel)]="warehouseInfo.productCode" />
                    </span>
                    <span class="ui-md-3 ui-lg-3 ui-sm-3" style="display: flex;">
                      <span style="display: flex;width: 65px">发次：</span>
                      <input disabled style=" width:150px;height: 35px;" name="sendTime" type="text"
                        [(ngModel)]="warehouseInfo.sendTime" />
                    </span>



                  </div>
                  <div *ngIf="checktype ==2" class="ui-g">
                    <span class="ui-md-3 ui-lg-3 ui-sm-3">
                      <span class="input-lable" style="margin-right: 26px;">型号：</span>
                      <input disabled style=" width:150px;height: 35px;" name="model" type="text"
                        [(ngModel)]="lookforMatchingOutputList.model" />
                    </span>
                    <span class="ui-md-3 ui-lg-3 ui-sm-3">
                      <span class="input-lable" style="margin-right: 26px;">发次：</span>
                      <input disabled style=" width:150px;height: 35px;" name="lotNo" type="text"
                        [(ngModel)]="lookforMatchingOutputList.lotNo" />
                    </span>
                    <span class="ui-md-3 ui-lg-3 ui-sm-3">
                      <span class="input-lable" style="margin-right: 13px;">芯级：</span>
                      <input disabled style=" width:150px;height: 35px;" name="coreGrade" type="text"
                        [(ngModel)]="lookforMatchingOutputList.coreGrade" />
                    </span>

                    <span class="ui-md-3 ui-lg-3 ui-sm-3">
                      <span class="input-lable">部套：</span>
                      <input disabled style=" width:150px;height: 35px;" name="partSleeve" type="text"
                        [(ngModel)]="lookforMatchingOutputList.partSleeve" />
                    </span>
                    <span class="ui-md-3 ui-lg-3 ui-sm-3">
                      <span class="input-lable">规程图号：</span>
                      <input disabled style=" width:150px;height: 35px;" name="techniqueNumber" type="text"
                        [(ngModel)]="lookforMatchingOutputList.techniqueNumber" />
                    </span>
                    <span class="ui-md-3 ui-lg-3 ui-sm-3">
                      <span class="input-lable">规程名称：</span>
                      <input disabled style=" width:150px;height: 35px;" name="techniqueName" type="text"
                        [(ngModel)]="lookforMatchingOutputList.techniqueName" />
                    </span>
                    <span class="ui-md-3 ui-lg-3 ui-sm-3">
                      <span class="input-lable">工序号：</span>
                      <input disabled style=" width:150px;height: 35px;" name="processesName" type="text"
                        [(ngModel)]="lookforMatchingOutputList.processesName" />
                    </span>
                    <span class="ui-md-3 ui-lg-3 ui-sm-3">
                      <span class="input-lable">工步：</span>
                      <input disabled style=" width:150px;height: 35px;" name="workStepName" type="text"
                        [(ngModel)]="lookforMatchingOutputList.workStepName" />
                    </span>
                  </div>
                  <div class="row align-items-center" style="margin-top: 25px;">
                    <div class="primeng-datatable-container">
                      <p-treeTable [value]="lookforMatchingOutputList.boundOutputs" [scrollable]="true"
                        scrollHeight="400px" [(selection)]="treeTableSelect" [scrollable]="true">
                        <ng-template pTemplate="header" let-rowData="rowData">
                          <tr>

                            <th style="width: 80px">
                              <!-- <p-treeTableHeaderCheckbox></p-treeTableHeaderCheckbox> -->
                              层级
                            </th>
                            <th style="width: 250px">操作</th>

                            <th style="width: 80px" >选择
                              <!-- <p-treeTableHeade‘rCheckbox></p-treeTableHeaderCheckbox> -->
                            </th>
                            <th style="width: 150px">物料图号</th>
                            <th style="width: 150px">物料名称</th>
                            <th style="width: 150px">规格</th>
                            <th style="width: 150px">物料类型</th>
                            <th style="width: 150px">单位</th>
                            <th style="width: 150px">工艺用料</th>
                            <th style="width: 150px">配套数量</th>
                            <th style="width: 150px">缺料数量</th>
                            <th style="width: 150px">待出库</th>
                            <th style="width: 150px">已出库数</th>
                            <th style="width: 150px">配套状态</th>

                          </tr>
                        </ng-template>
                        <ng-template pTemplate="body" let-rowNode let-rowData="rowData">
                          <tr [ttRow]="rowNode">
                            <td style="width: 80px">
                              <p-treeTableToggler [rowNode]="rowNode"></p-treeTableToggler>
                            </td>
                            <!-- *ngIf="(rowNode.node.children&&rowNode.node.children.length !=0)||rowNode.node.children==null" -->
                            <td style="width: 250px" *ngIf="rowData.nodeLevel ==10">
                              <!-- <a (click)="lookDetail(rowData,'选择出库',2) " href="javascript:;">选择出库</a>
                              <a style="margin-left: 10px;" (click)="lookDetail(rowData,'查看',2) "
                                href="javascript:;">查看</a> -->
                              <button [hidden]="rowData.nodeLevel == 9 || checktype ==4 " type="button" class="form-btn"
                                (click)="check(rowNode)">选择出库</button>
                              <button [hidden]="rowData.nodeLevel == 9 || returnTitle == '修改出库'" type="button"
                                class="form-btn" (click)="watch(rowNode)">查看</button>
                            </td>
                            <td style="width: 250px" *ngIf="rowData.nodeLevel !=10"></td>
                            <td style="width: 80px">
                              <p-treeTableCheckbox [disabled]="rowData.nodeLevel == 9 || checktype ==4" [value]="rowNode">
                              </p-treeTableCheckbox>
                            </td>

                            <td style="width: 150px">{{rowData.productDrawingNo}}</td>
                            <td style="width: 150px">{{rowData.productName}}</td>
                            <td style="width: 150px">{{rowData.moudel}}</td>
                            <td style="width: 150px">{{rowData.materialTypeName}}</td>
                            <td style="width: 150px">{{rowData.unit}}</td>
                            <td style="width: 150px">{{rowData.processDosage}}</td>
                            <td style="width: 150px">{{rowData.suiteStock}}</td>
                            <td style="width: 150px">{{rowData.shortageNum}}</td>
                            <td style="width: 150px">{{rowData.outboundQuantity}}</td>
                            <td style="width: 150px">{{rowData.outboundedNum}}</td>
                            <td style="width: 150px">{{rowData.assortState}}</td>
                          </tr>
                        </ng-template>
                      </p-treeTable>
                      <div style="margin-bottom: 15px;"></div>
                      <span *ngIf="checktype ==3 || checktype ==4">
                        <label class="lwid" style="margin-top: 5px;margin-left: 25px;">*退库人：</label>
                        <p-dropdown filter="true" #operationPersonSelect="ngModel" name="operationPerson"
                          [disabled]="checktype ==4"
                          [options]="inventoryPeopleList" placeholder="请选择退库人" dataKey="value" filterBy="label"
                          [optionLabel]="'label'" [(ngModel)]="operationPerson" emptyFilterMessage="暂无数据" required>
                          
                        </p-dropdown>
                        <validation-messages [formCtrl]="operationPersonSelect"></validation-messages>
                      </span>
                      <span *ngIf="checktype ==3 || checktype ==4">
                        <label style="margin-top: 5px;width: 91px;margin-left: 10px;">退库日期：</label>
                        <input disabled style="  width:150px;height: 35px;" name="operationTime" type="text"
                          [value]="operationTime |date:'yyyy-MM-dd'" />
                      </span>
                      <div *ngIf="checktype ==3" class="flex" style="margin-top: 15px;">
                        <label class="lwid" style="margin-top: 5px;">退库原因：</label>
                        <input style=" width:820px;height: 60px;margin-right: 10px;" name="reason" type="text"
                          [(ngModel)]="reason" />
                      </div>
                    </div>
                  </div>


                </div>
              </div>
              <!--  配套出库弹窗中列表查看-->
              <!-- 选择出库 -->
              <app-back-warehouse #BackWarehouseComponent [choose]="chooseSon" [editData]="rowData" [flag]="chooseFlag"
                [title]="title" [table]="oldTable" (modalSave)="backToEx($event)" [parentData]="parentData"></app-back-warehouse>
            </div>
          </div>
        </div>
        <div class="modal-footer" style="justify-content: center;">
          <button pButton type="button" (click)="close()" label="取消" style="margin-left: 0.5rem"></button>
          <button pButton *ngIf="checktype==3" [disabled]="operationPerson==undefind || operationPerson== ''" type="button" (click)="save()" label="保存"
            style="margin-left: 0.5rem"></button>
          <button *ngIf="checktype==2" pButton type="button" (click)="save()" label="保存"
            style="margin-left: 0.5rem"></button>
        </div>
      </form>
    </div>
  </div>


</div>